from django.http import HttpRequest
from app import tools
from app.models.contentModel import Content
from app.models.categoryModel import Category

def many(request:HttpRequest, category:int, page:int):
    """
    分页
    """
    per_page = 10
    end = page * per_page
    begin = end - per_page
    contents = Content.objects.filter(category = category)[begin:end].values()
    for content in contents:
        content['video'] = tools.url(content['video'])

    contents = list(contents)
    return tools.response(contents)

def collect(request:HttpRequest, id:int):
    """
    收藏
    """
    pass

def like(request:HttpRequest, id:int):
    """点赞"""
    pass